package view;
import java.awt.Color;
import java.awt.event.ActionListener;

import javax.swing.JLabel;
import javax.swing.JComboBox;
import javax.swing.JTextField;
import javax.swing.JButton;
/**
 *  this class is Graphic user interface of add type to Category that serves the Marketing Manager Employee, which extends Marketing Employee
 * @author gili
 *
 */
public class MMaddTypeGui extends AbstractGUI{
	
	private JTextField typeTxt;
	private JLabel lblChooseCategory;
	private JComboBox<String> comboBox;
	private JLabel lblAddType;
	private JButton btnFinish;
	private JButton btnCancel;
	private JLabel lblErrorMessage;
	
	public MMaddTypeGui() {
		getContentPane().setLayout(null);
		
		lblChooseCategory = new JLabel("Choose Category");
		lblChooseCategory.setBounds(21, 47, 114, 14);
		getContentPane().add(lblChooseCategory);
		
		comboBox = new JComboBox<String>();
		comboBox.setBounds(145, 44, 130, 20);
		getContentPane().add(comboBox);
		
		lblAddType = new JLabel("Enter Type");
		lblAddType.setBounds(21, 99, 89, 14);
		getContentPane().add(lblAddType);
		
		typeTxt = new JTextField();
		typeTxt.setBounds(145, 96, 130, 20);
		getContentPane().add(typeTxt);
		typeTxt.setColumns(10);
		
		btnFinish = new JButton("Finish");
		btnFinish.setBounds(46, 214, 89, 23);
		getContentPane().add(btnFinish);
		
		btnCancel = new JButton("Cancel");
		btnCancel.setBounds(145, 214, 89, 23);
		getContentPane().add(btnCancel);
		
		//getContentPane().setBackground(Color.green);
		getContentPane().setBackground(Color.LIGHT_GRAY);
		
		lblErrorMessage = new JLabel("Error Message");
		lblErrorMessage.setBounds(10, 11, 265, 14);
		lblErrorMessage.setVisible(false);
		lblErrorMessage.setForeground(Color.red);
		getContentPane().add(lblErrorMessage);
		
		this.setBounds(500, 200, 300, 300);
		this.setTitle("Marketing Manager/Add Type");
		this.setVisible(true);
		this.setResizable(false);
	}
	
	public void setWarningMes(String msg) {
		// TODO Auto-generated method stub
		getLblErrorMessage(msg).setVisible(true);
	}
	
	public JTextField getTypeTxt() {
		return typeTxt;
	}

	public JLabel getLblChooseCategory() {
		return lblChooseCategory;
	}

	public JComboBox<String> getComboBox() {
		return comboBox;
	}

	public JLabel getLblAddType() {
		return lblAddType;
	}

	public JButton getBtnFinish() {
		return btnFinish;
	}

	public JButton getBtnCancel() {
		return btnCancel;
	}

	public JLabel getLblErrorMessage(String msg) {
		lblErrorMessage.setText(msg);
		return lblErrorMessage;
	}

	
	public void ClearText(){
		typeTxt.setText("");
		comboBox.setSelectedIndex(0);
		//lblErrorMessage.setVisible(false);
	}
	
	public void addFinishActionListener(ActionListener listener){
		btnFinish.addActionListener(listener);
	}
	
	public void addCancelActionListener(ActionListener listener){
		btnCancel.addActionListener(listener);
	}
}
